package com.cmge.ad.bean;

public enum ErrorCode {

	success(0, "处理成功"), fail(-1, "处理失败"), handlerException(-2, "处理异常"), handlerParmException(-3,
	        "解析参数异常"), parmValiError(-4, "参数校验错误"), parmValiException(-5, "参数校验异常"), parmNull(-6, "参数为空");

	ErrorCode(int code, String message) {
		this.code = code;
		this.message = message;
	};

	public static ErrorCode getByCode(int code) {
		for (ErrorCode obj : ErrorCode.values()) {
			if (obj.getCode() == code) {
				return obj;
			}
		}
		return null;
	}

	int code;
	String message;

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}
